<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/WEB-INF/templates/portalTemplate.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:my="http://java.sun.com/jsf/composite/components">
	<ui:define name="content">
		<h:form>
			<rich:panel
				header="Dostępnych kursów:  #{lessonListBrowser.coursesCount}">

				<h:outputText value="#{_text.get('student.dostepne.lekcje.info')}" />
				<h:outputText
					value="#{_text.get('student.dostepne.lekcje.brak.kursow.info')}"
					rendered="#{lessonListBrowser.courses.size()==0}" />
				<h:outputText
					value="#{_text.get('student.dostepne.lekcje.sa.kursy.info')}"
					rendered="#{lessonListBrowser.courses.size()>0}" />
				<rich:dataGrid columns="1" value="#{lessonListBrowser.courses}"
					var="_course">
					<rich:collapsiblePanel switchType="client"
						header="#{_course.title}">
						<rich:dataTable value="#{_course.lessons}" var="_lesson">
							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Nr lekcji" />
								</f:facet>
								<h:outputText value="#{_lesson.number}"
									style="#{not _lesson.educationStates.toArray()[0].shared  or _lesson.educationStates.toArray()[0].read ? '' : 'font-weight:bold;'   }" />
							</rich:column>
							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Wprowadzenie do lekcji" />
								</f:facet>
								<h:outputText value="#{_lesson.shortIntroduction}"
									style="#{not _lesson.educationStates.toArray()[0].shared  or _lesson.educationStates.toArray()[0].read ?  '' : 'font-weight:bold;'   }" />
							</rich:column>
							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Data udostępnienia" />
								</f:facet>
								<h:outputText
									value="#{_lesson.educationStates.toArray()[0].sharedDate}"
									style="#{not _lesson.educationStates.toArray()[0].shared  or _lesson.educationStates.toArray()[0].read ?  '' : 'font-weight:bold;'   }">
									<f:convertDateTime pattern="dd.MM.yyyy" />
								</h:outputText>
							</rich:column>

							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Data wysłania rozwiązania" />
								</f:facet>
								<h:outputText
									value="#{_lesson.educationStates.toArray()[0].sentDate}"
									style="#{not _lesson.educationStates.toArray()[0].shared  or _lesson.educationStates.toArray()[0].read ?  '' : 'font-weight:bold;'   }">
									<f:convertDateTime pattern="dd.MM.yyyy" />
								</h:outputText>
							</rich:column>

							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Data sprawdzenia rozwiązania" />
								</f:facet>
								<h:outputText
									value="#{_lesson.educationStates.toArray()[0].checkedDate}"
									style="#{not _lesson.educationStates.toArray()[0].shared  or _lesson.educationStates.toArray()[0].read ?  '' : 'font-weight:bold;'   }">
									<f:convertDateTime pattern="dd.MM.yyyy" />
								</h:outputText>
							</rich:column>

							<rich:column styleClass="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'nowa_lekcja' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'nieodczytany_komentarz':'')}">
								<f:facet name="header">
									<h:outputText value="Operacje" />
								</f:facet>
								<h:outputText value="Lekcja jeszcze nie została udostępniona." rendered="#{!_lesson.educationStates.toArray()[0].shared}" />
								
								
								<a4j:commandButton value="Przejdź do lekcji"
									rendered="#{_lesson.educationStates.toArray()[0].shared}"
									action="#{lessonListBrowser.goToLesson(_lesson.id)}"
									styleClass="buttonSmall" >
									<rich:tooltip value="${_lesson.educationStates.toArray()[0].shared and not _lesson.educationStates.toArray()[0].sent ? 'Przejdź do wypełniania lekcji' : (_lesson.educationStates.toArray()[0].checked and _lesson.educationStates.toArray()[0].readCommentDate eq null ? 'Odczytaj komentarz nauczyciela':'Przejdź do lekcji')}"/>
									</a4j:commandButton>
							</rich:column>

						</rich:dataTable>

					</rich:collapsiblePanel>

				</rich:dataGrid>
			</rich:panel>

		</h:form>
	</ui:define>
</ui:composition>